import java.awt.Color;
import java.awt.Graphics;


public class Player extends Paddle{
	
	int x, y;
	int speed = 7;
	
	InputHandler input = new InputHandler();
	
	/** The starting X and Y coords */
	public Player(int x, int y)
	{
		this.x = x;
		this.y = y;
	}

	public void render(Graphics g) 
	{
		g.setColor(Color.green);
		g.fillRect(x, y, 10, 60);
	}

	public void tick() 
	{
		if(input.goingUp)
		{
			y -= speed;
			System.out.println("Going Up");
		}
		if(input.goingDown)
		{
			y += speed;
			System.out.println("Going Down");
		}
		
		checkCollision();
		
	}

	public boolean checkCollision() 
	{
		if(y <= 0)
		{
			y = 0;
			return true;
		}
		else if(y + 80 >= Pong.YSIZE)
		{
			y = Pong.YSIZE - 80;
			return true;
		}
		
		return false;
	}

	public boolean checkScreen() 
	{
		return false;
	}
}
